package org.goyo.main.domain.entity.base;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.goyo.main.domain.entity.BaseObject;
import org.goyo.main.domain.entity.system.SysUser;

/**
 * 供应商
 * 
 * @author chenchuan
 * 2014年11月5日
 */
@Entity
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"number"})})
public class Supplier extends BaseObject  implements Serializable {
	
	private static final long serialVersionUID = 1L;
	//单据编号前缀
	public static final String BIZTYPE = "GYS";
	
	/**
	 * 类型
	 */
	public static final String TYPE = "SUPPLIER";
	
	/**
	 * 供应商分类
	 */
	@ManyToOne
    @JoinColumn(name="supplierClassificationId")
	private SupplierClassification supplierClassification;
	
	/**
	 * 业务分析码	
	 *//*
	@Column
	private String businessNum;*/
	/**
	 * 所属采购员
	 */
	@ManyToOne
	@JoinColumn(name="sysUserId")
	private SysUser subBuyer;
	/**
	 * 内部供应商	
	 */
	@Column
	private String inerCustomer;
	/**
	 * 内部公司	
	 */
	@Column
	private String inerCompany;
	/**
	 * 上级供应商	
	 */
	@Column
	private String superCustomer;
/*	*//**
	 * 供应商性质	
	 *//*
	@ManyToOne
    @JoinColumn(name="supplierProperId")
	private SuppliersNature supplierProper;*/
	
	/**
	 * 供应商性质
	 */
	@Column
	private String supplierNature;
	/**
	 * 工商注册号	
	 */
	@Column
	private String industrialNum;
	/**
	 * 营业执照	
	 */
	@Column
	private String tradingNum;
	/**
	 * 经营许可证	
	 */
	@Column
	private String manageNum;
	/**
	 * 税务登记号	
	 */
	@Column
	private String taxNumber;
	/**
	 * 法人代表	
	 */
	@Column
	private String legalPerson;
	/**
	 * 行业	
	 */
	@Column
	private String industry;
	/**
	 * 国家	
	 */
	@Column
	private String country;
	/**
	 * 省份	
	 */
	@Column
	private String province;
	/**
	 * 城市	
	 */
	@Column
	private String city;
	/**
	 * 区县	
	 */
	@Column
	private String district;
	/**
	 * 地址	
	 */
	@Column
	private String address;
	/**
	 * 邮政编码	
	 */
	@Column
	private String zipCode;
	/**
	 * 税种	
	 */
	@Column
	private String taxType;
	/**
	 * 税率	
	 */
	@Column
	private String taxRate;
	/**
	 * 开票类型	
	 */
	@Column
	private String makeType;
	
	/**
	 * 供应商财务资料
	 */
	@OneToOne(cascade={CascadeType.ALL})
	@JoinColumn(name="financeId")
	private SupplierFinance finance;
	
	/**
	 * 供应商采购资料
	 */
	@OneToOne(cascade={CascadeType.ALL})
	@JoinColumn(name="purId")
	private SupplierPur pur;
	
/*	public String getBusinessNum() {
		return businessNum;
	}
	public void setBusinessNum(String businessNum) {
		this.businessNum = businessNum;
	}*/
	public String getInerCustomer() {
		return inerCustomer;
	}
	public void setInerCustomer(String inerCustomer) {
		this.inerCustomer = inerCustomer;
	}
	public String getInerCompany() {
		return inerCompany;
	}
	public void setInerCompany(String inerCompany) {
		this.inerCompany = inerCompany;
	}
	public String getSuperCustomer() {
		return superCustomer;
	}
	public void setSuperCustomer(String superCustomer) {
		this.superCustomer = superCustomer;
	}

/*	public SuppliersNature getSupplierProper() {
    return supplierProper;
  }
  public void setSupplierProper(SuppliersNature supplierProper) {
    if(supplierProper != null &&("".equals(supplierProper.getUuid()) || supplierProper.getUuid()==null))
      this.supplierProper = null;
    else
        this.supplierProper = supplierProper;
  }*/
	
  public String getIndustrialNum() {
		return industrialNum;
	}
	public String getSupplierNature() {
    return supplierNature;
  }
  public void setSupplierNature(String supplierNature) {
    this.supplierNature = supplierNature;
  }
  public void setIndustrialNum(String industrialNum) {
		this.industrialNum = industrialNum;
	}
	public String getTradingNum() {
		return tradingNum;
	}
	public void setTradingNum(String tradingNum) {
		this.tradingNum = tradingNum;
	}
	public String getManageNum() {
		return manageNum;
	}
	public void setManageNum(String manageNum) {
		this.manageNum = manageNum;
	}
	public String getTaxNumber() {
		return taxNumber;
	}
	public void setTaxNumber(String taxNumber) {
		this.taxNumber = taxNumber;
	}
	public String getLegalPerson() {
		return legalPerson;
	}
	public void setLegalPerson(String legalPerson) {
		this.legalPerson = legalPerson;
	}
	public String getIndustry() {
		return industry;
	}
	public void setIndustry(String industry) {
		this.industry = industry;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getDistrict() {
		return district;
	}
	public void setDistrict(String district) {
		this.district = district;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getZipCode() {
		return zipCode;
	}
	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}
	public String getTaxType() {
		return taxType;
	}
	public void setTaxType(String taxType) {
		this.taxType = taxType;
	}
	public String getTaxRate() {
		return taxRate;
	}
	public void setTaxRate(String taxRate) {
		this.taxRate = taxRate;
	}
	public String getMakeType() {
		return makeType;
	}
	public void setMakeType(String makeType) {
		this.makeType = makeType;
	}
	public SupplierFinance getFinance() {
		return finance;
	}
	public void setFinance(SupplierFinance finance) {
	  if(finance != null &&("".equals(finance) || finance.getUuid()==null))
	      this.finance = null;
	    else
	        this.finance = finance;
	}
	public SupplierPur getPur() {
		return pur;
	}
	public void setPur(SupplierPur pur) {
	  if(pur != null &&("".equals(pur) || pur.getUuid()==null))
	      this.pur = null;
	    else
	        this.pur = pur;
	}
  public SupplierClassification getSupplierClassification() {
    return supplierClassification;
  }
  public void setSupplierClassification(SupplierClassification supplierClassification) {
    if(supplierClassification != null &&("".equals(supplierClassification) || supplierClassification.getUuid()==null))
      this.supplierClassification = null;
    else
        this.supplierClassification = supplierClassification;
  }
  public SysUser getSubBuyer() {
    return subBuyer;
  }
  public void setSubBuyer(SysUser subBuyer) {
    if(subBuyer != null &&("".equals(subBuyer) || subBuyer.getUuid()==null)){
      this.subBuyer = null;
    }else{
      this.subBuyer = subBuyer;
    }
  }
	
	
	
	

}
